<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>函数</title>
</head>
<body>
    <script>

        function findObj(param1,param2){
            console.log(param1);
            console.log(param2);
        }

        findObj('money','handsame');

        let obj={
            money:100000,
        }

        function changeObj(obj){
            // obj={
            //     money:500000
            // }
            obj.money=500000
        }
        changeObj(obj);
        console.log(obj); 

    //不定参数
        function params(name,age,...param2){
            console.log(name);// js
            console.log(age);//25
            console.log(param2);//[26,27,28]
        }
       params('js',25,26,27,28)

    //对象形式调用
       function createObj(param1,param2){
            this.param1 = param1;
            this.param2= param2;
            console.log(this);
            window.createObjThis1=this;
            this.endTime ='7月份';
                       
        } 
       createObj.prototype.work=function(){
                console.log('找份好工作');
            }      
       createObj.prototype.endTime='8月中旬实习';



       let obj3 = new createObj('money','handsame');
       console.log(obj3);
       window.createObjThis2=obj3;

       let obj4 = new createObj('money','handsame');
       console.log(obj3==obj4);


       //console.log(obj3[[[Prototype]]])
       console.log(obj3.__proto__);
       console.log(createObj.prototype);
       console.log(obj3.__proto__===createObj.prototype);
       console.log(obj3);
       obj3.work();

       obj4.work();
       console.log(obj3.__proto__===obj4.__proto__);

       console.log(obj3);
       console.log(obj3.endTime);
       console.log(obj4.endTime);

       obj3.__proto__.getMoney=5000;
       obj3.__proto__.findObj='2';
       console.log(obj3.getMoney);
       console.log(obj4.getMoney);
       console.log(obj4.findObj);

       

    // 设计模式中，有原型模式，
    //    class obj1{
    //        constructor(name,age){
    //            this.name = name ;
    //            this.age = age;
    //        }
    //    }

    //    new obj1('JS',100); //JS 100  0X1010
    //    new obj1('JS',100); //JS 100  0X1011




    </script>
</body>
</html>